Skip to content

Conversation

@lcaresia
Copy link
Collaborator

@lcaresia lcaresia commented Sep 23, 2025

WHY

Summary by CodeRabbit

  • New Features
    • Added Rosette “Extract Entities” action with options for confidence, salience, and DBpedia types.
    • Added “Match Names” action to compare two names and return a similarity score.
    • Added “Translate Name” action with a target language picker that dynamically lists supported languages.
  • Chores
    • Bumped Rosette Text Analytics package version to 0.1.0.

@lcaresia lcaresia self-assigned this Sep 23, 2025
@vercel
Copy link

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Sep 23, 2025 11:51am
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 23, 2025 11:51am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

Walkthrough

Adds three new Rosette actions (extract entities, match names, translate name), extends the app with propDefinitions, HTTP helper methods and Rosette API wrappers (matchName, translateName, extractEntities, getLanguages), and updates package metadata (version and dependency).

Changes

Cohort / File(s) Summary
Rosette actions (new)
components/rosette_text_analytics/actions/extract-entities/extract-entities.mjs, components/rosette_text_analytics/actions/match-names/match-names.mjs, components/rosette_text_analytics/actions/translate-name/translate-name.mjs
Adds three action modules exposing Rosette APIs. Each exports an action object with metadata, props wired to the app's propDefinitions, an async run({ $ }) that calls the corresponding app method, exports a short $summary, and returns the API response.
App client enhancements
components/rosette_text_analytics/rosette_text_analytics.app.mjs
Introduces comprehensive propDefinitions (nameOne, nameTwo, name, targetLanguage with dynamic options, content, calculateConfidence, calculateSalience, includeDBpediaTypes); adds _baseUrl(), _makeRequest(opts) (axios, X-RosetteAPI-Key header), and high-level methods: matchName, translateName, extractEntities, getLanguages. Removes prior authKeys helper.
Package metadata
components/rosette_text_analytics/package.json
Bumps version from 0.0.1 to 0.1.0 and adds a dependencies entry for @pipedream/platform: ^3.1.0.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Action as Action (Pipedream)
  participant App as Rosette App Client
  participant HTTP as _makeRequest
  participant API as Rosette API

  User->>Action: Trigger action with props
  Action->>App: Call method (matchName / translateName / extractEntities) with data
  App->>HTTP: Build request (base URL, headers, payload)
  HTTP->>API: POST /v1/... with X-RosetteAPI-Key
  API-->>HTTP: JSON response
  HTTP-->>App: Response
  App-->>Action: Response
  Action-->>User: Export $summary and return data

  note over App,HTTP: Header X-RosetteAPI-Key sourced from this.$auth.api_key
Loading
sequenceDiagram
  autonumber
  participant Action_E as Extract Entities
  participant App
  participant API as Rosette /v1/entities
  Action_E->>App: extractEntities({ content, options })
  App->>API: POST body { content, options{calculateConfidence, calculateSalience, includeDBpediaTypes} }
  API-->>App: entities[]
  App-->>Action_E: response
Loading
sequenceDiagram
  autonumber
  participant Action_M as Match Names
  participant App
  participant API as Rosette /v1/name-similarity
  Action_M->>App: matchName({ name1.text, name2.text })
  App->>API: POST body { name1, name2 }
  API-->>App: score
  App-->>Action_M: response
Loading
sequenceDiagram
  autonumber
  participant Action_T as Translate Name
  participant App
  participant API as Rosette /v1/name-translation
  Action_T->>App: translateName({ name, targetLanguage })
  App->>API: POST body { name, targetLanguage }
  API-->>App: translation, confidence
  App-->>Action_T: response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nibble on bytes with whiskers keen,
Three fresh tricks in our Rosette machine—
Names that match, and tongues that sing,
Entities hop out, spring by spring.
Version bumped, I thump with glee, carrots for code and API tea. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description contains only the repository template with an empty "WHY" section ("") and provides no rationale, summary of changes, testing instructions, or migration notes, so it is incomplete and does not explain why the changes were made. Please fill the "WHY" section with a concise purpose statement and add a summary of the changes made, any user-facing impacts or migration steps, how the change was tested, and links to related issues or documentation so reviewers can evaluate the PR.
Title Check ❓ Inconclusive The PR title "[Components] rosette_text_analytics #10937" only names the component and issue number and does not summarize the primary change (for example, adding the Rosette app client and new action modules), so it is too vague for a reviewer to understand the intent at a glance. Please update the title to a short, specific sentence describing the main change, for example: "Add rosette_text_analytics app and actions for entity extraction, name matching, and name translation."
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-10937

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d2cce5 and edfa58a.

📒 Files selected for processing (1)
  • components/rosette_text_analytics/package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/rosette_text_analytics/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pnpm publish

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lcaresia lcaresia linked an issue Sep 23, 2025 that may be closed by this pull request
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (7)
components/rosette_text_analytics/actions/translate-name/translate-name.mjs (1)

7-7: Optional: Align component version metadata.
To reflect the package bump to 0.1.0, consider updating this action’s version to 0.1.0.

-  version: "0.0.1",
+  version: "0.1.0",
components/rosette_text_analytics/actions/match-names/match-names.mjs (2)

36-36: Optional: Format score to two decimals in summary.
Improves readability without changing behavior.

-    $.export("$summary", "Successfully compared names, resulting in a score of " + response.score);
+    $.export("$summary", "Successfully compared names, resulting in a score of " + (typeof response.score === "number" ? response.score.toFixed(2) : response.score));

7-7: Optional: Align component version metadata.
To reflect the package bump to 0.1.0, consider updating this action’s version to 0.1.0.

-  version: "0.0.1",
+  version: "0.1.0",
components/rosette_text_analytics/actions/extract-entities/extract-entities.mjs (2)

48-48: Guard against missing entities in summary.
Avoids runtime errors if the API returns no entities array.

-    $.export("$summary", "Successfully extracted " + response.entities.length + " entities");
+    $.export("$summary", "Successfully extracted " + (Array.isArray(response?.entities) ? response.entities.length : 0) + " entities");

7-7: Optional: Align component version metadata.
To reflect the package bump to 0.1.0, consider updating this action’s version to 0.1.0.

-  version: "0.0.1",
+  version: "0.1.0",
components/rosette_text_analytics/rosette_text_analytics.app.mjs (2)

26-33: Harden language options mapping (null-safety).
Prevents crashes if the API shape changes or is empty; you can enhance labeling later if the API returns display names.

-      async options() {
-        const response = await this.getLanguages();
-        const languages = response.supportedLanguagePairs;
-        return languages.map(({ target }) => ({
-          label: target.language,
-          value: target.language,
-        }));
-      },
+      async options() {
+        const response = await this.getLanguages();
+        const pairs = response?.supportedLanguagePairs ?? [];
+        return pairs.map(({ target = {} }) => ({
+          label: target.language,
+          value: target.language,
+        }));
+      },

70-77: Set sane HTTP defaults (timeout, JSON headers).
Adds resiliency and explicit content negotiation.

-      return axios($, {
-        ...otherOpts,
-        url: this._baseUrl() + path,
-        headers: {
-          "X-RosetteAPI-Key": `${this.$auth.api_key}`,
-          ...headers,
-        },
-      });
+      return axios($, {
+        timeout: 30000,
+        ...otherOpts,
+        url: this._baseUrl() + path,
+        headers: {
+          "X-RosetteAPI-Key": `${this.$auth.api_key}`,
+          "Accept": "application/json",
+          "Content-Type": "application/json",
+          ...headers,
+        },
+      });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c007db and 1d2cce5.

📒 Files selected for processing (5)
  • components/rosette_text_analytics/actions/extract-entities/extract-entities.mjs (1 hunks)
  • components/rosette_text_analytics/actions/match-names/match-names.mjs (1 hunks)
  • components/rosette_text_analytics/actions/translate-name/translate-name.mjs (1 hunks)
  • components/rosette_text_analytics/package.json (1 hunks)
  • components/rosette_text_analytics/rosette_text_analytics.app.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
components/rosette_text_analytics/actions/translate-name/translate-name.mjs (2)
components/rosette_text_analytics/actions/extract-entities/extract-entities.mjs (1)
  • response (37-47)
components/rosette_text_analytics/actions/match-names/match-names.mjs (1)
  • response (25-35)
components/rosette_text_analytics/actions/extract-entities/extract-entities.mjs (2)
components/rosette_text_analytics/actions/match-names/match-names.mjs (1)
  • response (25-35)
components/rosette_text_analytics/actions/translate-name/translate-name.mjs (1)
  • response (25-31)
components/rosette_text_analytics/actions/match-names/match-names.mjs (3)
components/rosette_text_analytics/actions/extract-entities/extract-entities.mjs (1)
  • response (37-47)
components/rosette_text_analytics/actions/translate-name/translate-name.mjs (1)
  • response (25-31)
components/rosette_text_analytics/rosette_text_analytics.app.mjs (1)
  • response (27-27)
components/rosette_text_analytics/rosette_text_analytics.app.mjs (3)
components/rosette_text_analytics/actions/extract-entities/extract-entities.mjs (1)
  • response (37-47)
components/rosette_text_analytics/actions/match-names/match-names.mjs (1)
  • response (25-35)
components/rosette_text_analytics/actions/translate-name/translate-name.mjs (1)
  • response (25-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (2)
components/rosette_text_analytics/package.json (1)

3-3: Version bump looks good. Consider aligning component versions.
Package version is 0.1.0 while the new actions declare "0.0.1". If you want consistent semver across this package, bump the action metadata to 0.1.0 as well. If versions are intentionally decoupled, ignore.

components/rosette_text_analytics/actions/match-names/match-names.mjs (1)

24-35: LGTM — correct payload shape for name similarity.
The request structure matches Rosette expectations (name1/name2 objects with text).

Comment on lines +25 to +33
const response = await this.app.translateName({
$,
data: {
name: this.name,
targetLanguage: this.targetLanguage,
},
});
$.export("$summary", "Successfully translated name with " + response.confidence + " confidence");
return response;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix request payload shape for Rosette translate API (wrap name in { text }).
Rosette APIs expect name fields as objects with a text property. Sending a string will likely 400. Also, make the summary robust to missing fields.

Apply this diff:

-    const response = await this.app.translateName({
-      $,
-      data: {
-        name: this.name,
-        targetLanguage: this.targetLanguage,
-      },
-    });
-    $.export("$summary", "Successfully translated name with " + response.confidence + " confidence");
-    return response;
+    const response = await this.app.translateName({
+      $,
+      data: {
+        name: { text: this.name },
+        targetLanguage: this.targetLanguage,
+      },
+    });
+    $.export(
+      "$summary",
+      `Translated ${this.name} to ${this.targetLanguage}` +
+        (response?.translatedName ? `: ${response.translatedName}` : "") +
+        (typeof response?.confidence === "number" ? ` (confidence: ${response.confidence})` : "")
+    );
+    return response;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const response = await this.app.translateName({
$,
data: {
name: this.name,
targetLanguage: this.targetLanguage,
},
});
$.export("$summary", "Successfully translated name with " + response.confidence + " confidence");
return response;
const response = await this.app.translateName({
$,
data: {
name: { text: this.name },
targetLanguage: this.targetLanguage,
},
});
$.export(
"$summary",
`Translated ${this.name} to ${this.targetLanguage}` +
(response?.translatedName ? `: ${response.translatedName}` : "") +
(typeof response?.confidence === "number" ? ` (confidence: ${response.confidence})` : "")
);
return response;
🤖 Prompt for AI Agents
In components/rosette_text_analytics/actions/translate-name/translate-name.mjs
around lines 25 to 33, the payload sends name as a raw string but Rosette
expects name fields as an object with a text property; change the request data
to send name: { text: this.name } (keep targetLanguage unchanged), and make the
exported summary robust by handling missing response.confidence (e.g., default
to 'unknown' or similar) so the summary string never breaks.

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lcaresia, LGTM! Ready for QA!

@vunguyenhung vunguyenhung merged commit 8b6d4e3 into master Sep 26, 2025
7 of 10 checks passed
@vunguyenhung vunguyenhung deleted the issue-10937 branch September 26, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Components] rosette_text_analytics

4 participants